// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import Pagination from "@/components/Pagination";
//自定义表格工具扩展
import RightToolbar from "@/components/RightToolbar"

//import axios from 'axios'
Vue.use(ElementUI)
Vue.config.productionTip = false
// 全局组件挂载
Vue.component('Pagination', Pagination)
Vue.component('RightToolbar', RightToolbar)

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
// router.beforeEach((to, from, next) => {

//  if (to.matched.some(m=>m.meta.requireAuth)) { // 判断该路由是否需要登录权限
//     if(JSON.parse(localStorage.getItem('islogin'))){ //判断本地是否存在access_token
//       next();
//    }else {
//     next({
//         path:'/login'
//      })
//     }
//  }
//   else {
//     next();
//   }
//  /*如果本地 存在 token 则 不允许直接跳转到 登录页面*/
//   if(to.fullPath == "/login"){
//     if(JSON.parse(localStorage.getItem('islogin'))){
//      next({
//        path:from.fullPath
//       });
//    }else {
//       next();
//     }
//   }
// });